use "$path\Intermediary Data\localshock_dataforReg_v2.dta",clear

drop if prix_ht==.
drop  j j3
replace d_dieselr=resid_movav_diesel
xtset id daten
gen d_dieselrott=ln(diesel_rotterdam_euro)-ln(l1.diesel_rotterdam_euro)
drop diesel_rotterdam_euro resid_movav_diesel dprix1 

drop d_dieselr
gen d_dieselr=d_dieselrott

merge m:m id using  "$path\Intermediary Data\base_id_suff_stat_6Y"
keep if _m==3
drop _m

merge m:m id using  "$path\Intermediary Data\base_base_suff_stat_6Y_forinteractkurtfreq"
keep if _m==3
drop _m

capture drop delta_lprix delta_lprix_ht
bysort id (daten): gen delta_lprix=ln(prix)-ln(prix[_n-1])
bysort id (daten): gen delta_lprix_ht=ln(prix_ht)-ln(prix_ht[_n-1])

bysort daten: gen first_obs=1 if _n==1

replace delta_lprix=delta_lprix*100
replace delta_lprix_ht=delta_lprix_ht*100
replace d_dieselr=d_dieselr*100


graph twoway  (hist delta_lprix if delta_lprix!=0 & delta_lprix<=5 & delta_lprix>=-5,  width(0.25) col(gs10%50) legend(off)) (hist delta_lprix_ht if delta_lprix_ht!=0 & delta_lprix_ht<=5 & delta_lprix_ht>=-5, width(0.25) col(none) lcolor(black) legend(off)) (kdensity d_dieselr if first_obs==1 & d_dieselr<=5 & d_dieselr>=-5, ytitle("Density") xtitle("Percent price change")  lcolor(black)  graphregion(color(white)) legend(off))
graph export "$path\Graphs_Tables\Figure2.png", replace
graph export "$path\Graphs_Tables\Figure2.eps", replace

